home *** CD-ROM | disk | FTP | other *** search
- Hi all.
-
- Last month i got frpm Aminet Proclib30 for AMOS and AMOS Pro.
- I found some very interesting input routines for real and integer
- numbers and for strings. So i modified these procedures for
- binary an hexadecimal numbers.
- These are the modified procedures:
-
-
- Procedure B_INPUT[L]
- '
- ' INPUT ROUTINE FOR BINARY NUMBERS
- '
- ' L : Length of field (Default character % exclused).
- '
- '
- ' This routine accepts only the numbers 0 and 1
- ' (Plus RETURN to end and BACKSPACE to delete the last character.)
- ' Characters "%"(for binary numbers) is for default.
- ' It is therefore more fool-proof than the normal INPUT command.
- '
- '
- '
- ' Basic routine written in 1994 by Christian Mumenthaler
- ' Revisioned for Binary Numbers by Luca Ferraris - 02/95
- ' This routine is Public Domain. Use it wherever you want to.
- '
- '
- NA$="%"
- Z=Len(NA$)
- L1=L-Z
- Print NA$+Space$(L1);
- Cmove -L1,0
- Curs On
- A1=Asc("0") : A2=Asc("1")
- Repeat
- A$=Inkey$
- A$=Upper$(A$)
- A=Asc(A$)
- If((A>=A1 and A<=A2)) and Z<=L
- Print A$;
- NA$=NA$+A$
- Inc Z
- End If
- If A$=Chr$(8) and Z>0
- Z=Z-1
- Cmove -1,0 : Print " "; : Cmove -1,0
- NA$=Left$(NA$,Len(NA$)-1)
- End If
- Until A$=Chr$(13)
- Curs Off
- A#=Val(NA$)
- End Proc[A#]
-
-
- Procedure H_INPUT[L]
- '
- ' INPUT ROUTINE FOR HEXADECIMAL NUMBERS
- '
- ' L : Length of field (Default character "$" exclused).
- '
- '
- ' This routine accepts only the numbers from 0 to 9 and characters
- ' from A to F.
- ' (Plus RETURN to end and BACKSPACE to delete the last character.)
- ' Characters "$"(for binary numbers) is for default.
- ' It is therefore more fool-proof than the normal INPUT command.
- '
- '
- '
- ' Basic routine written in 1994 by Christian Mumenthaler
- ' Revisioned for Hexadecimal Numbers by Luca Ferraris - 02/95
- ' This routine is Public Domain. Use it wherever you want to.
- '
- '
- NA$="$"
- Z=Len(NA$)
- L1=L-Z
- Print NA$+Space$(L1);
- Cmove -L1,0
- Curs On
- A1=Asc("0") : A2=Asc("F")
- Repeat
- A$=Inkey$
- A$=Upper$(A$)
- A=Asc(A$)
- If((A>=A1 and A<=A2)) and Z<=L
- Print A$;
- NA$=NA$+A$
- Inc Z
- End If
- If A$=Chr$(8) and Z>0
- Z=Z-1
- Cmove -1,0 : Print " "; : Cmove -1,0
- NA$=Left$(NA$,Len(NA$)-1)
- End If
- Until A$=Chr$(13)
- Curs Off
- A#=Val(NA$)
- End Proc[A#]
-
- Hallo from Luca Ferraris (aldo@di.unito.it)
- -------------------------------------------
-
-
-